Skip to content

Conversation

@lvalentine6
Copy link
Member

@lvalentine6 lvalentine6 commented Jul 11, 2025

✨ 개요

  • 자동 ERD 워크플로를 만들었습니다.
  • 그러나 스키마에서 제약조건을 사용하지 않아 정상적으로 ERD가 생성되지 않네요.
  • 중요한 기능은 아니니 나중에 반영해도 될것 같아요

🧾 관련 이슈

🔍 참고 사항 (선택)

Summary by CodeRabbit

  • New Features
    • 풀 리퀘스트 생성 시 데이터베이스 ERD(엔터티 관계 다이어그램)를 자동으로 생성하여 GitHub Pages에 배포하고, 관련 링크를 PR에 댓글로 안내하는 기능이 추가되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Jul 11, 2025

"""

Walkthrough

새로운 GitHub Actions 워크플로우가 추가되어, Pull Request 발생 시 Flyway 마이그레이션을 적용한 MySQL 스키마를 DBML로 변환하고 ERD 이미지를 생성한 뒤 GitHub Pages에 배포합니다. 또한, PR에 ERD 링크를 포함한 코멘트를 자동으로 남깁니다.

Changes

파일/경로 변경 요약
.github/workflows/automatic-erd.yml PR 트리거 기반 ERD 자동 생성 및 GitHub Pages 배포 워크플로우 추가

Sequence Diagram(s)

sequenceDiagram
    participant PR as Pull Request
    participant Actions as GitHub Actions Workflow
    participant MySQL as MySQL (서비스)
    participant Flyway as Flyway CLI
    participant Node as Node.js 환경
    participant DBML as dbml-cli
    participant Pages as GitHub Pages
    participant Comment as PR Comment

    PR->>Actions: PR 생성/업데이트 트리거
    Actions->>MySQL: MySQL 서비스 시작
    Actions->>Flyway: 마이그레이션 적용
    Flyway->>MySQL: 스키마 변경
    Actions->>MySQL: 스키마 덤프 (SQL)
    Actions->>Node: Node.js 및 dbml-cli 설치
    Actions->>DBML: SQL→DBML 변환
    Actions->>DBML: DBML→ERD(SVG) 변환
    Actions->>Pages: ERD 및 HTML 배포
    Actions->>Comment: PR에 ERD 링크 코멘트
Loading

Possibly related issues

Suggested labels

chore

Suggested reviewers

  • leegwichan

Poem

🐰
브랜치 위에 ERD 한 송이,
자동화로 피어난 도식의 꿈.
PR마다 펼쳐지는 스키마의 그림,
깃헙 페이지에 살포시 안긴다네.
토끼는 오늘도 기쁘게 점프!
🖼️✨
"""


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/automatic-erd.yml (2)

83-89: PR 간 결과물이 덮어쓰여 과거 PR 링크가 깨질 수 있습니다.
force_orphan: true로 매번 gh-pages 전체를 갱신하면 마지막 실행 결과만 보존됩니다. PR 코멘트가 가리키는 ERD가 이후 실행으로 덮여쓰여 내용이 달라질 수 있으므로, PR 번호별 하위 디렉터리로 퍼블리시하는 방식을 권장합니다.

-          publish_dir: ./erd
+          publish_dir: ./erd
+          destination_dir: pr-${{ github.event.pull_request.number }}

코멘트 URL도 동일하게 수정해야 합니다.


20-30: 호스트 포트 고정 바인딩은 충돌 위험이 있으므로 불필요합니다.
서비스 컨테이너는 네트워크 브리지로 연결되어 있으며, 호스트(액션 러너)에서 127.0.0.1:3306 으로 접속하기 위해 굳이 포트를 노출할 필요가 없습니다. 포트 매핑을 제거하면 다른 워크플로(또는 서비스)와의 충돌 가능성을 줄일 수 있습니다.

-        ports:
-          - 3306:3306
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cea611d and 2c1cc59.

📒 Files selected for processing (1)
  • .github/workflows/automatic-erd.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test

@github-actions
Copy link

📄 Terraform Plan Summary

🛡️ Common Infrastructure


No plan summary

Status: ✅ No Changes


🛠️ Development Environment


No plan summary

Status: ✅ No Changes


📋 Full Results: View in Actions

@github-actions
Copy link

📌 최신 ERD가 자동 생성되었습니다.

👉 ERD 보러가기

@sonarqubecloud
Copy link

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
.github/workflows/automatic-erd.yml (2)

57-61: mysqldump 실행 전 mysql-client 설치가 여전히 누락되었습니다

ubuntu-latest 러너에는 mysqldump 바이너리가 포함돼 있지 않아 이 단계에서 즉시 실패합니다. 지난 코멘트와 동일한 이슈이므로 반영해 주세요.

       - name: Dump database schema
-        run: |
-          mkdir -p erd
-          mysqldump -h 127.0.0.1 -u ${{ secrets.TEST_DB_USER }} -p${{ secrets.TEST_DB_PASSWORD }} --no-data --skip-comments testdb > erd/schema.sql
+        run: |
+          sudo apt-get update -y
+          sudo apt-get install -y mysql-client
+          mkdir -p erd
+          mysqldump -h 127.0.0.1 \
+            -u ${{ secrets.TEST_DB_USER }} -p${{ secrets.TEST_DB_PASSWORD }} \
+            --no-data --skip-comments testdb > erd/schema.sql

67-76: DBML 툴 체인 설치가 불완전합니다

sql2dbml 패키지는 전역 설치 목록에 없고, @dbml/cli 만으로는 sql2dbml/dbml-renderer 커맨드를 직접 제공하지 않습니다. npx가 즉석 설치를 시도하긴 하나, 캐시 없는 CI 환경에선 네트워크 이슈로 실패할 확률이 높습니다. 두 커맨드를 확실히 사용하려면 아래처럼 명시적으로 설치하세요.

-      - name: Install DBML Tools
-        run: npm install -g @dbml/cli @softwaretechnik/dbml-renderer
+      - name: Install DBML Tools
+        run: |
+          npm install -g @dbml/cli @softwaretechnik/dbml-renderer sql2dbml

또는 dbml 서브커맨드( dbml convert, dbml render )로 통일하는 방법도 있습니다.

🧹 Nitpick comments (1)
.github/workflows/automatic-erd.yml (1)

80-80: HTML wrapper 경로 하드코딩 주의

index.html 내부 <img src='erd.svg'> 는 현재 디렉터리 기준 상대 경로입니다. 추후 디렉터리 구조를 변경하거나 다른 정적 호스팅으로 이전할 때 깨질 수 있으니, 필요하다면 절대 경로(/erd.svg) 나 ./erd.svg 처럼 명시적 경로로 두는 방안을 고려해 주세요.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c1cc59 and 6e9f2ec.

📒 Files selected for processing (1)
  • .github/workflows/automatic-erd.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test

@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@YAPP-Github YAPP-Github deleted a comment from github-actions bot Jul 11, 2025
@lvalentine6 lvalentine6 changed the title ci: 자동 ERD 생성 워크플로 구현 [Ci] 자동 ERD 생성 워크플로 구현 Jul 11, 2025
Copy link
Member

@leegwichan leegwichan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/noti
늦은 Approve 죄송합니다;; 작업 확인했습니다!

@lvalentine6 lvalentine6 merged commit 60f3d62 into develop Jul 14, 2025
12 checks passed
@lvalentine6 lvalentine6 deleted the ci/PRODUCT-154 branch July 14, 2025 09:40
@github-actions
Copy link

🎉 This PR is included in version 1.4.0-develop.19 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions
Copy link

🎉 This PR is included in version 1.5.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants